}
$this->setVar( '_Extensions', $status->value );
} elseif ( isset( $options['with-extensions'] ) ) {
- $status = $this->findExtensions();
- if ( !$status->isOK() ) {
- throw new InstallException( $status );
- }
- $this->setVar( '_Extensions', array_keys( $status->value ) );
+ $this->setVar( '_Extensions', array_keys( $this->findExtensions() ) );
}
// Set up the default skins
}
$skins = $status->value;
} else {
- $status = $this->findExtensions( 'skins' );
- if ( !$status->isOK() ) {
- throw new InstallException( $status );
- }
- $skins = array_keys( $status->value );
+ $skins = array_keys( $this->findExtensions( 'skins' ) );
}
$this->setVar( '_Skins', $skins );
*
* @param string $directory Directory to search in, relative to $IP, must be either "extensions"
* or "skins"
- * @return Status An object containing an error list. If there were no errors, an associative
- * array of information about the extension can be found in $status->value.
+ * @return array[][] [ $extName => [ 'screenshots' => [ '...' ] ]
*/
public function findExtensions( $directory = 'extensions' ) {
switch ( $directory ) {
*
* @param string $type Either "extension" or "skin"
* @param string $directory Directory to search in, relative to $IP
- * @return Status An object containing an error list. If there were no errors, an associative
- * array of information about the extension can be found in $status->value.
+ * @return array [ $extName => [ 'screenshots' => [ '...' ] ]
*/
protected function findExtensionsByType( $type = 'extension', $directory = 'extensions' ) {
if ( $this->getVar( 'IP' ) === null ) {
- return Status::newGood( [] );
+ return [];
}
$extDir = $this->getVar( 'IP' ) . '/' . $directory;
if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
- return Status::newGood( [] );
+ return [];
}
$dh = opendir( $extDir );
$exts = [];
- $status = new Status;
while ( ( $file = readdir( $dh ) ) !== false ) {
- // skip non-dirs and hidden directories
- if ( !is_dir( "$extDir/$file" ) || $file[0] === '.' ) {
+ if ( !is_dir( "$extDir/$file" ) ) {
continue;
}
- $extStatus = $this->getExtensionInfo( $type, $directory, $file );
- if ( $extStatus->isOK() ) {
+ $status = $this->getExtensionInfo( $type, $directory, $file );
+ if ( $status->isOK() ) {
$exts[$file] = $status->value;
- } else {
- $status->merge( $extStatus );
}
}
closedir( $dh );
uksort( $exts, 'strnatcasecmp' );
- $status->value = $exts;
-
- return $status;
+ return $exts;
}
/**
$this->getFieldsetEnd()
);
- $skins = $this->parent->findExtensions( 'skins' )->value;
+ $skins = $this->parent->findExtensions( 'skins' );
$skinHtml = $this->getFieldsetStart( 'config-skins' );
$skinNames = array_map( 'strtolower', array_keys( $skins ) );
'value' => $chosenSkinName,
] );
- // @phan-suppress-next-line PhanTypeNoAccessiblePropertiesForeach
foreach ( $skins as $skin => $info ) {
if ( isset( $info['screenshots'] ) ) {
$screenshotText = $this->makeScreenshotsLink( $skin, $info['screenshots'] );
$this->getFieldsetEnd();
$this->addHTML( $skinHtml );
- $extensions = $this->parent->findExtensions()->value;
+ $extensions = $this->parent->findExtensions();
$dependencyMap = [];
if ( $extensions ) {
$extByType = [];
$types = SpecialVersion::getExtensionTypes();
// Sort by type first
- // @phan-suppress-next-line PhanTypeNoAccessiblePropertiesForeach
foreach ( $extensions as $ext => $info ) {
if ( !isset( $info['type'] ) || !isset( $types[$info['type']] ) ) {
// We let extensions normally define custom types, but
if ( count( $screenshots ) > 1 ) {
$links = [];
$counter = 1;
-
- // @phan-suppress-next-line PhanTypeNoAccessiblePropertiesForeach
foreach ( $screenshots as $shot ) {
$links[] = Html::element(
'a',
* @return bool
*/
public function submitSkins() {
- $skins = array_keys( $this->parent->findExtensions( 'skins' )->value );
+ $skins = array_keys( $this->parent->findExtensions( 'skins' ) );
$this->parent->setVar( '_Skins', $skins );
if ( $skins ) {
$this->setVar( 'wgRightsIcon', '' );
}
- $skinsAvailable = array_keys( $this->parent->findExtensions( 'skins' )->value );
+ $skinsAvailable = array_keys( $this->parent->findExtensions( 'skins' ) );
$skinsToInstall = [];
foreach ( $skinsAvailable as $skin ) {
$this->parent->setVarsFromRequest( [ "skin-$skin" ] );
$retVal = false;
}
- $extsAvailable = array_keys( $this->parent->findExtensions()->value );
+ $extsAvailable = array_keys( $this->parent->findExtensions() );
$extsToInstall = [];
foreach ( $extsAvailable as $ext ) {
$this->parent->setVarsFromRequest( [ "ext-$ext" ] );